import json

import numpy as np

from calcAnimal import calcAnimal
from calcDir import calcDir
from main import animalNum2_3, checkShoe, Director
from utils import crd_grid_to_game, is_intersect, one_zero_map


with open("data.json", "r",encoding='utf-8') as file:
  jsonData = json.load(file)
  dir={
    "TOP":(-10,0),
    "RIGHT":(0,10),
    "DOWN":(10,0),
    "LEFT":(0,-10),
    "STOP":(0,0)
  }
  game=Director()
  map=np.array(jsonData["map"])
  routes=[(9,11),(10,11)]
  # tag= is_intersect((315, 715),50,crd_grid_to_game((6,13),50),50)
  # print(tag,'tag')
  # p1=[p for p in jsonData['playerStateVos'] if p['playerId']=='xfj'][0]
  # p2=[p for p in jsonData['playerStateVos'] if p['playerId']=='robot5'][0]
  # flag= calcDir(map,(p1['y'],p1['x']),routes,10,[(p2['y'],p2['x'])])
  flag= calcDir(map, (345, 565), [(6, 11), (6, 10), (6, 9), (6, 8), (5, 8), (5, 7), (4, 7)], 5, [])
  print(flag)
  
  
  
  
    
    
   